# 执法管理
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage
import uuid
import random


class EnforceTheLawManager(KeyWords):
    url = KeyWords.url + 'law-enforcement-inspection/list'

    def create_case(self):
        '''
        新建事件
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\enforce_the_law_manager\create_case.yaml')
        element_operation(self, data[0]['data'])

    def case_list(self):
        '''
        查询事件列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\enforce_the_law_manager\case_list.yaml')
        element_operation(self, data[0]['data'])

    def case_accept(self):
        '''
        事件受理
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\enforce_the_law_manager\case_accept.yaml')
        element_operation(self, data[0]['data'])

    def case_dispatch(self):
        '''
        事件派遣
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\enforce_the_law_manager\case_dispatch.yaml')
        element_operation(self, data[0]['data'])

    def case_deal(self):
        '''
         事件处置
         :return:
         '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\enforce_the_law_manager\case_deal.yaml')
        element_operation(self, data[0]['data'])

    def case_check_and_archive(self):
        '''
         事件核查和归档
         :return:
         '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\enforce_the_law_manager\case_check_and_archive.yaml')
        element_operation(self, data[0]['data'])

    def case_deal_with_self(self):
        '''
        # 新增自发自处事件
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\enforce_the_law_manager\case_deal_with_self.yaml')
        element_operation(self, data[0]['data'])


if __name__ == '__main__':
    try:
        driver = choose_browser()
        L = LonginPage(driver)
        L.login('kobeAdmin002', 'kobe8888')
        case = EnforceTheLawManager(driver)
        case.case_dispatch()
        driver.quit()
    except Exception as e:
        driver.quit()
